
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by IntelliJ IDEA.
 * User: liuliwei
 * Date: 2017-07-27
 * Time: 下午3:41
 * Description: ${description}
 */
public class ThreadPool {
    private static int j=0;
    public ThreadPool() {
        jj=5;
    }


    {
        jj=3;
    }

    private  int jj = 3;

    public static void main(String[] args) {
        ExecutorService threadPool = Executors.newFixedThreadPool(2);
        for (int i = 0; i < 500000000; i++) {
            j=i;
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    Thread thread = Thread.currentThread();
                    System.out.println(thread+"dfd"+j);
                    try {
                        Thread.sleep(70);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(thread+"finish");
                }
            };
            Thread thread = new Thread(runnable);
            thread.setPriority(10);
            threadPool.execute(thread);
        }
        System.out.println("jie shu le ");

    }
}
